import xhfConfig from "./XHFConfig";
import xhdConfig from "./XHDConfig";
import commonConfig from "./commonConfig";
import xhbConfig from "./XHBConfig";
import XHQBConfig from "./XHQBConfig";
import qs from "qs";
import {isServer} from "../tools/utils";

const InterfaceG = {
	...XHQBConfig,
	...xhfConfig,
	...xhdConfig,
	...commonConfig,
	...xhbConfig,
	//---------小辉钱包---start-------------
	verifyCode: "/verifyCode/register/1", //短信验证码
	indexPage: "/wealth/indexPage", // 首页数据
	productBuyInit: "/wealth/productBuyInit", //产品购买
	bindCard: "/personal/bindCard/0", //电子开户获取验证码
	personAuth: "/personal/personAuth/0", //电子开户提交验证码（开户）
	accountInit: "/userCenter/accountInit", //电子开户页面初始化
	createElectronicAccount: "/wealth/createElectronicAccount", //电子开户页面一键开户接口
	getMyBankInfo: "/cfInfo/getMyBankInfo", //我的银行初始化接口
	electronicAccount: "/wealth/electronicAccount", //银行电子账户首页
	// uploadIdCardImage: "/file/uploadIdCardImage", //上传身份证图片
	uploadIdCardOcrForHt: "/file/uploadIdCardOcrForHt", //上传身份证图片
	xhbUploadIdCardOcrForHt: "/yhjrapp/idcard/uploadIdCardOcrForHt", //小辉宝上传身份证图片
	uploadIdCardImageAgain: "/file/uploadIdCardImageAgain", //财富重新上传身份证并ocr识别
	reUploadIdCardSubmit: "/file/reUploadIdCardSubmit", //财富重新上传身份证提交
	// getIdCardInfo: "/file/getIdCardInfo", //身份信息下一步
	xhbConformIdCardInfo: "/yhjrapp/idcard/appConformIdCardInfo", //身份证OCR信息下一步
	conformIdCardInfo: "/file/conformIdCardInfo", //小辉宝身份证OCR信息下一步
	createElectronicVcode: "/wealth/createElectronicVcode", //开户发送短信验证码
	electronicAmount: "/wealth/electronicAmount", //充值、提现页面初始化
	changePhoneInit: "/userCenter/changePhoneInit", //更换手机号初始化
	changePhoneVcode: "/personal/changePhoneVcode", //更换手机发短信
	changePhone: "/personal/changePhone", //更换手机号
	eleRechargeSendSms: "/cfInfo/eleRechargeSendSms", //电子户充值发送短信
	eleRecharge: "/cfInfo/eleRecharge", //电子账户充值

	eleAcctSignQuery: "/cfInfo/eleAcctSignQuery", // 电子户签约查询
	getEleAcctSignCode: "/cfInfo/getEleAcctSignCode", // 电子户签约获取验证码
	eleAcctSignAuth: "/cfInfo/eleAcctSignAuth", // 电子户签约认证

	eleWithdraw: "/cfInfo/eleWithdraw", //电子账户提现
	addBankCardBindCard: "/personal/bindCard/1", //添加银行卡获取短信
	addBankCard: "/personal/addBankCard", //添加新的银行卡
	queryProductInfos: "/wealth/queryProductInfos", // 赚钱产品/产品详情接口
	holdStockAmount: "/wealth/holdStockAmount", // 持仓查询接口
	holdStockAmountDetail: "/wealth/holdStockAmountDetail", // 持仓详情(P+)接口
	changeCardInit: "/userCenter/changeCardInit", //更换银行卡初始化
	changeCardVcode: "/personal/changeCardVcode", //更换银行卡发短信
	changeCard: "/personal/changeCard", //更换银行卡
	getSupportBank: "/dic/getSupportBank", //支持银行卡
	// actTrsQry: "/cfInfo/actTrsQry", //电子户资金明细查询接口
	actTrsQry: "/api-wealth/electronicAccount/actTrsQry", //收支明细查询接口

	financeTradeDetail: "/fm/financeTradeDetail",
	tradeDetail: "/wealth/tradeDetail", // 交易记录详情接口
	productVerifyCode: "/wealth/sendVerifyCode", //产品购买发送短信验证码
	productBuy: "/wealth/productBuy", //产品购买接口
	fycPlusProductBuy: "/wealth/fycPlusProductBuy", //产品购买接口(P+)
	getContract: "/personal/getContract/0", //服务协议授权书接口
	productRedeemInit: "/wealth/productRedeemInit", //支取初始化
	productRedeem: "/wealth/productRedeem", //产品支取
	fycPlusProductRedeem: "/wealth/fycPlusProductRedeem", //产品支取(P+)
	productRedeemTrial: "/wealth/productRedeemTrial", //产品支取试算接口
	addInvitationCode: "/cfInfo/addInvitationCode", //添加邀请码
	checkCfOpenInfo: "/wealth/checkCfOpenInfo", //华通开户信息校验

	//---------小辉钱包---end-------------
	holdingsInit: "/fm/holdingsInit", //小辉宝首页初始化接口
	productDetails: "/fm/productDetails", //小辉宝产品详情
	financeBill: "/fm/financeBill", //订单查询通用结接口
	financeRedeemInit: "/fm/financeRedeemInit", //通用财富赎回初始化接口
	smsMessage: "/fm/smsMessage", //通用发短信接口
	financeRedeem: "/fm/financeRedeem", //通用产品赎回接口
	financeTrial: "/fm/financeTrial", // 赎回试算接口
	/**一键转出初始化 */
	oneKeyRollOutInit: "/rollOut/oneKeyRollOutInit",
	/**一键转出提交 */
	oneKeyRollOutCommit: "/rollOut/oneKeyRollOutCommit",
	/** 获取验证码 */
	getSmsCode: "/huaTongSms/getSmsCode",
	/**查询小辉宝银行锁定状态 */
	queryXhbBankLockStatus: "/fm/queryXhbBankLockStatus",
	/**查询小辉宝转入按钮锁定状态 */
	queryXhbBuyBtnLockStatus: "/fm/queryXhbBuyBtnLockStatus",
	/**查询小辉宝转出按钮锁定状态 */
	queryXhbRedeemBtnLockStatus: "/fm/queryXhbRedeemBtnLockStatus",

	// ---------- 老带新邀请 ---------
	queryActivityEffect: "/inviteActivity/queryActivityEffect", //查询老带新活动是否可用
	inviteShare: "/inviteActivity/inviteShare", //老带新邀请分享
	queryInviteActivityRecordList:
		"/inviteActivity/queryInviteActivityRecordList", //邀请记录
	queryInviteActivityRewardList:
		"/inviteActivity/queryInviteActivityRewardList", //奖励记录
	inviteRegister: "/inviteActivity/inviteRegister", //老带新邀请注册
	inviteSendValidCode: "/inviteActivity/sendValidCode" //老带新发送验证码
	// paytrade:"/JRPayService/pay/trade", //模拟扫枪
};

let version = { sdkVersionCode: "1.0.0" };
let channelCode = "YHB"; // 整个app的渠道号
let agreements_url; // 协议h5地址
let sSecurityUrl; // 山证开户
let sSecurityUrlObj; // 山证开户环境

// 根据渠道区分山证的环境
// TODO 服务器渲染默认是 clientCode = 05
const clientCodeObj = isServer ? {clientCode: "05"}: qs.parse(location.search.slice(1));
let { clientCode = "05" } = clientCodeObj;
if (process.env.ENV_CONFIG != "prod") {
	agreements_url = "https://huikaidian-sit.yonghui.cn/apph5/agreements";
	sSecurityUrlObj = {
		// 金融app渠道
		"01": "https://yhth5.i618.com.cn/p/JuHxES",
		// 生活渠道
		"05": "https://yhth5.i618.com.cn/p/TvtI5z"
	};
} else {
	agreements_url = "https://jrcdn.yonghui.cn/yhjr/agreements";
	sSecurityUrlObj = {
		// 金融app渠道
		"01": "https://yhth5.i618.com.cn/p/JuHxES",
		// 生活渠道
		"05": "https://yhth5.i618.com.cn/p/TvtI5z"
	};
}

sSecurityUrl = sSecurityUrlObj[clientCode];

export {
	agreements_url,
	version,
	channelCode,
	InterfaceG,
	sSecurityUrl,
	clientCodeObj
};
